﻿component 
{
    this.Name = "Lightweight Template Framework";
    this.HeaderName = "Lightweight Template Framework";
    this.ApplicationTimeout = CreateTimeSpan( 0, 0, 180, 0 );
    this.SessionManagement = true;
    this.SessionTimeout = CreateTimeSpan(0,0,20,0);    
    this.SetClientCookies = true;
    
    /*  CF9 ORM settings  
    this.Datasource = "{datasource}";
    this.ormenabled = true;
    this.ormsettings = {
        logsql = true,
        dbcreate = "none",
        cfclocation = "models"
    };*/
    
    public boolean function onApplicationStart(){
        APPLICATION.version = "0.1";
        APPLICATION.Name = "Lightweight Template Framework";
        APPLICATION.HeaderName = "Lightweight Template Framework";
        //*** OPTIONAL - If you use Encrypt(), Decrypt(), it makes sense to specify your encryption string here.
        APPLICATION.ENCRYPTION_ALGORITHM = "RC4";
        APPLICATION.ENCRYPTION_ENCODING = "hex";
        APPLICATION.ENCRYPTION_KEY = "VEDKEY";        
        return true;
    }


    public void function onApplicationEnd(ApplicationScope){

    }


    public void function onRequest(String targetPage){
        include arguments.targetPage;
    }


    public boolean function onRequestStart(String targetPage){
        /*ORMReload();  CF9 ORM setting  */    
        return true;
    }


    public void function onRequestEnd(String targetPage){

    }


    public void function onSessionStart(){
        Var FUNC = StructNew();
        session.rootDir = ListGetAt(CGI.PATH_INFO,1,"/");
        session.Authenticated = false;
        SESSION.IsPasswordGood = 0;
        if( !IsDefined("SCF_Employee_GetEmpInfo_FromLogin") ){
            include "/code_lib/SCF_Employee.cfm";        
        }
        SESSION.myUserInfo = SCF_Employee_GetEmpInfo_FromLogin(ListGetAt(CGI.AUTH_USER, 2, '\'),ListGetAt(CGI.AUTH_USER, 1, '\'));
        SESSION.IsPasswordGood = 0;
    }


    public void function onSessionEnd(SessionScope,ApplicationScope){

    }


    public boolean function onMissingTemplate(String targetPage) {

        return true;
    }

    //Uncomment below to handle this type of exception
    /*public void function onError(Exception,EventName) {

    }

    //Uncomment below to handle this type of exception
    public void function onMissingMethod(String method,Struct args) {

    }*/


    public void function onCFCRequest(String cfcname,String method,Struct args){

    }

}